home *** CD-ROM | disk | FTP | other *** search
- #include <SetUpA4.h>
- #include <A4Stuff.h>
-
- #define OLDROUTINELOCATIONS 0
- #define OLDROUTINENAMES 0
- #define SystemSevenOrLater 1
-
- #ifndef __FONTS__
- # include <Fonts.h>
- #endif
-
- #ifndef __DIALOGS__
- # include <Dialogs.h>
- #endif
-
- #ifndef __LOWMEM__
- # include <LowMem.h>
- #endif
-
- #define Y_OFFSET 100
- #define X_OFFSET 100
-
- static pascal OSErr InitMac (void)
- {
- MaxApplZone ( );
- InitGraf (&(qd.thePort));
- InitFonts ( );
- InitWindows ( );
- InitMenus ( );
- TEInit ( );
- InitDialogs (nil);
-
- return noErr;
- }
- Boolean inJGNE;
- void *gOldJGNE;
- static Boolean gFilterDone;
- Boolean myGNE (EventRecord *event, Boolean result);
- pascal asm void myJGNE(void);
- static long mytime;
- Boolean finderLoaded=false;
-
- PicHandle p;
-
- Boolean myGNE (EventRecord *, Boolean result)
- {
- OSErr err;
- AEAddressDesc addy;
- AppleEvent evt;
- Str255 s;
- Rect winRect;
- GrafPtr old;
- ProcessSerialNumber psn = { 0, 2 };
- WindowPtr w;
-
- if (!finderLoaded)
- {
- if (EqualString(LMGetCurApName(),"\pFinder",true,true))
- finderLoaded = true;
- }
-
- if((TickCount() - mytime > 200) && (finderLoaded)) {
-
-
- mytime = TickCount();
- GetCurrentProcess(&psn);
- /*if( ( EqualString(LMGetCurApName(),"\pBolo 0.99.7",true,true) ) ||
- ( EqualString(LMGetCurApName(),"\pMyth II",true,true) ))
- {
- */
- if( ( !EqualString(LMGetCurApName(),"\pFinder",true,true) ) &&
- ( !EqualString(LMGetCurApName(),"\pCodeWarrior IDE 4.1B4",true,true) ) &&
- ( !EqualString(LMGetCurApName(),"\pExtensions Manager",true,true) ) &&
- ( !EqualString(LMGetCurApName(),"\pChooser",true,true) )
- )
- {
- winRect = (**p).picFrame;
- OffsetRect(&winRect, -winRect.left + X_OFFSET, -winRect.top + Y_OFFSET);
- GetPort(&old);
- w = NewWindow( nil, & winRect, "\pFun Police", true, altDBoxProc, (WindowPtr)-1L, false, nil);
- SetPort(w);
- DrawPicture(p,&w->portRect);
- while(Button())
- ;
-
- while(!Button())
- ;
- SetPort(old);
- DisposeWindow(w);
- FlushEvents(everyEvent,0);
-
- err = AECreateDesc(typeProcessSerialNumber, &psn,
- sizeof(psn), &addy);
-
- if(err != noErr) {
- DebugStr("\p err 1");
- NumToString(err,s);
- DebugStr(s);
- }
- err = AECreateAppleEvent (kCoreEventClass, kAEQuitApplication, &addy, kAutoGenerateReturnID,
- kAnyTransactionID, &evt);
-
- if(err != noErr) {
- DebugStr("\p err 2");
- NumToString(err,s);
- DebugStr(s);
- }
-
- err = AESend (&evt, nil, kAENoReply, kAENormalPriority, kAEDefaultTimeout, nil, nil);
-
- if(err != noErr) {
- DebugStr("\p err 3");
- NumToString(err,s);
- DebugStr(s);
- }
- // DebugStr("\pExit");
- }
- }
- return result;
- }
-
- pascal asm void myJGNE(void){
- //DC.W 0xa9ff
- MOVE.L D0,A0 // save pre-result from SetUpA4
- JSR SetCurrentA4 // fix A4, stomp D0
- MOVE.L D0,-(A7) // save old A4
- MOVE.L A0,D0 // restore pre-result
- TST.B inJGNE // is myJGNE busy?
- BNE @1 // yes, so bail
- MOVE.B #true,inJGNE // mark myJGNE busy
- MOVE.W D0,-(A7) // push pre-result
- MOVE.L A1,-(A7) // push event record pointer
- JSR myGNE // do the real work/
- MOVE.L (A7)+,A1 // restore event record pointer
- ADDQ.L #2,A7 // pop pre-result; post-result in D0
- ASL.W #8,D0 // bump C boolean to Lisa
- MOVE.W D0,8(A7) // stash result where caller expects it
- MOVE.B #false,inJGNE // mark myJGNE not busy
- @1:
- MOVE.L gOldJGNE,A0 // get previous jGNE
- MOVE.L (A7)+,A4 // restore A4
- //cmp.l #0,a0
- //beq bail
- MOVE.L A0,-(A7) // return to previous jGNE
- bail:
- RTS
- }
-
- void main (void){
- long oldA4 = SetCurrentA4();
- Handle theInit = 0L;
- p = GetPicture(192);
- DetachResource((Handle)p);
- mytime = TickCount();
- if (((long*)0x174)[1] & 0x02) SysBeep(7)
- ;
- else {
- theInit = Get1Resource('INIT',0);
- gOldJGNE = LMGetGNEFilter();
- LMSetGNEFilter(myJGNE);
- DetachResource(theInit);
- }
- SetA4(oldA4);
- }
-